from tortoise import BaseDBAsyncClient

RUN_IN_TRANSACTION = True


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `dept` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `name` VARCHAR(100) NOT NULL COMMENT '部门名称',
    `local` VARCHAR(100) NOT NULL COMMENT '办公地址'
) CHARACTER SET utf8mb4 COMMENT='部门表';
CREATE TABLE IF NOT EXISTS `employee` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `name` VARCHAR(100) NOT NULL COMMENT '员工姓名',
    `age` INT NOT NULL COMMENT '员工年龄',
    `email` VARCHAR(100) NOT NULL COMMENT '员工邮箱',
    `created` DATETIME(6) NOT NULL COMMENT '注册时间' DEFAULT CURRENT_TIMESTAMP(6),
    `dept_id` INT NOT NULL,
    CONSTRAINT `fk_employee_dept_3e1c4256` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE CASCADE
) CHARACTER SET utf8mb4 COMMENT='员工表';
CREATE TABLE IF NOT EXISTS `aerich` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `version` VARCHAR(255) NOT NULL,
    `app` VARCHAR(100) NOT NULL,
    `content` JSON NOT NULL
) CHARACTER SET utf8mb4;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        """


MODELS_STATE = (
    "eJztmG1vokAQx7+K4VUv6TVqQfHeUWtTr9d6ab2H9CFkhQFJYZeD5VrT+N1vdwF5EqtJq1"
    "7SN1RmZ5adH7M7f/oiecQENzw6BZ9KXxovEkYesB8F+2FDQr6fWbmBookrHM3UYxLSABl8"
    "Fgu5IRzyodAIHJ86BHPP+6jXBJVdFX5V1Y7K40xisEAH28wFR67LTBF2/kSgU2IDnULABu"
    "4emNnBJjxDmN76j7rlgGsWlu2YfE5h1+nMF7YhpmfCkT9tohvEjTycOfszOiV44e1gkY4N"
    "GAJEgU9Pg4inw1eXZJ1mGK80c4mXmIsxwUKRS7P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